<?php
/**
 * Created by .
 * User: luogan
 * Date: 2021/12/30
 */

namespace App\Validate\Api;


class AuthRoleValidate extends BaseValidate
{
    protected function rule(): array
    {
        return [
            'username' => "required",
            'password' => "required",
        ];
    }

    protected function message(): array
    {
        return [
            'name.required' => '请填写账号',
            'phone.required' => '请填写密码',
        ];
    }

    protected function callBack(): array
    {
        return [
            'checkName' => function ($attribute, $value, $parameters, $validator) {
                if ($value != 111) {
                    throw new ErrorMessageException("这里是自定义验证器checkName");
                }
                return true;
            },
            'checkPhone' => function ($attribute, $value, $parameters, $validator) {
                if ($value != "abc") {
                    throw new ErrorMessageException("这里是自定义验证器checkPhone");
                }
                return true;
            }
        ];
    }

    protected function sceneList()
    {
        return $this->only([]);
    }

    protected function sceneCreate()
    {
        return $this->only([]);
    }

    protected function sceneUpdate()
    {
        return $this->only([]);
    }


    protected function sceneDetail()
    {
        return $this->only([]);
    }

    protected function sceneDelete()
    {
        return $this->only([]);
    }
}
